import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const router = new Router({
	mode: 'history',
	routes: [
		{
			path: '/aging',
			name: 'aging',
			component: () => import('../views/aging.vue'),
			meta: {
				title: '履约时效分析'
			}
		},
		{
			path: '/unusual_store',
			name: 'unusual_store',
			component: () => import('../views/unusual_store.vue'),
			meta: {
				title: '履约异常门店'
			}
		},
		{
			path: '/timeout_order',
			name: 'timeout_order',
			component: () => import('../views/timeout_order.vue'),
			meta: {
				title: '履约异常订单'
			}
		}
	]
})

/* 路由发生变化修改页面title */
router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

export default router